/** \file qwwsettings.h
 * \brief QWordWizard Settings dialog
 */
#ifndef __QWWSETTINGS_H
#define __QWWSETTINGS_H

#include <QDialog>
#include "ui_qwwsettings.h"
#include <vector>
#include <utility>

using namespace std;

/** \class QWWSettings
 * \brief Settings dialog
 */
class QWWSettings : public QDialog
{
    Q_OBJECT

    public:
        /**
         * Constructor
         * \param parent Parent widget
         */
        QWWSettings(QWidget *parent = 0);

        /**
         * Destructor
         */
        ~QWWSettings();

        /**
         * Get timer interval
         * \return Timer interval
         */
        int GetInterval() const;

        /**
         * Set timer interval
         * \param interval Timer interval
         */
        void SetInterval(int interval);

        /**
         * Get loaded dictionaries
         * \param dic Loaded dictionaries
         */
        void GetDictionaries(vector<pair<bool, QString> > &dic) const;

        /**
         * Set loaded dictionaries
         * \param dic Loaded dictionaries
         */
        void SetDictionaries(const vector<pair<bool, QString> > &dic);

    private:
        /**
         * Insert line to the table
         * \param used Used flag
         * \param description Dictionary description
         * \param path Dictionary location
         */
        void InsertTableLine(bool used, QString description, QString path);

        /**
         * Get dictionary description
         * \param filename Dictionary filename
         * \return Description
         */
        QString GetDictionaryDescription(QString filename);

    private slots:
        /**
         * Add dictionary
         */
        void AddDictionary();

        /**
         * Remove dictionary from the table
         */
        void RemoveDictionary();

        /**
         * Edit dictionary
         */
        void EditDictionary();

    private:
        Ui::dlgSettings m_ui;              /**< UI */
};

#endif
